//
//  MCTableView.swift
//  WisdomSpace
//
//  Created by goulela on 2017/8/30.
//  Copyright © 2017年 MC. All rights reserved.
//

import UIKit

class MCTableView: UITableView {


    override init(frame: CGRect, style: UITableViewStyle) {
        super.init(frame: frame, style: style)
        
        self.separatorStyle = UITableViewCellSeparatorStyle.none
        self.backgroundColor = UIColor.white
        self.bgImageView.frame = frame
        self.backgroundView = self.bgImageView
        
        
        
        /** 防止tableViewCell 刷新的时候乱跳动
         * 原因 在iOS 10Self-Sizing自动打开后
          contentSize和contentOffset都可能发生改变
         */
        self.estimatedRowHeight = 0
        self.estimatedSectionFooterHeight = 0
        self.estimatedSectionFooterHeight = 0
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    

    
    public func showBgImage() {
        self.bgImageView.isHidden = false
    }
    
    public func hideBgImage() {
        self.bgImageView.isHidden = true
    }
    
    
    public lazy var bgImageView: UIImageView = {
        let bgImageView = UIImageView.init()
        bgImageView.image = UIImage.init(named: "Reuse_emptyData")
        bgImageView.contentMode = UIViewContentMode.center
        bgImageView.isHidden = true
        return bgImageView
    }()

}




